import { identity, isNumber, pickBy } from 'lodash';
import request from '@/http/request';
import { IQueryParams } from '@/widgets/table-pagination';

export function getList(queryParams: IQueryParams) {
  let params: any = {
    ...queryParams,
    pageNo: queryParams.pageNum,
    ...pickBy(queryParams.filter, identity),
    ...pickBy(queryParams.filter, isNumber),
  };

  return request.post(`/admin-api/system/dept/list`, params);
}

export function deleteItem(id:number){
  return request.delete(`/admin-api/system/dept/delete?id=${id}`);
}

export function createItem(entity: any) {
  return request.post(`/admin-api/system/dept/create`, entity);
}

export function updateItem(entity: any) {
  return request.put(`/admin-api/system/dept/update`, entity);
}